#!/usr/bin/env python
# coding: utf-8

# In[43]:


import requests
url_geo = 'https://restapi.amap.com/v3/geocode/geo?parameters'
payload = {
    'key':'f82fc299ab87b74c0281a8ed2b13aba0',
    'address':'广东省广州市从化区广州南方学院'
}

r = requests.get(url=url_geo,params=payload)


# In[44]:


r


# In[45]:


r.json()


# In[46]:


location = r.json()['geocodes'][0]['location']
location


# In[47]:


regeo_url = 'https://restapi.amap.com/v3/geocode/regeo?parameters'
payload = {
    'key':'f82fc299ab87b74c0281a8ed2b13aba0',
    'location':location,
    'extensions':'all',
    'poitype':'true'
}

r = requests.get(url=regeo_url,params=payload)


# In[48]:


r.json()


# In[49]:


pois = r.json()['regeocode']['pois']
pois


# In[50]:


中餐厅_location = r.json()['regeocode']['pois'][-2]['location']
中餐厅_location


# In[51]:


中餐厅_id = r.json()['regeocode']['pois'][-2]['id']
中餐厅_id


# In[ ]:





# In[52]:


url_id = 'https://restapi.amap.com/v5/place/detail?parameters'
payload = {
    'key':'f82fc299ab87b74c0281a8ed2b13aba0',
    'id':中餐厅_id,
    'location':中餐厅_location,
    'show_fields':'photos'
}
r = requests.get(url=url_id,params=payload)


# In[53]:


# r.json()


# In[54]:


r


# In[55]:


r.json()


# In[56]:


type = r.json()['pois'][0]['type']
type


# In[57]:


location_nan = r.json()['pois'][0]['location']
location_nan


# In[61]:


url = 'https://restapi.amap.com/v3/assistant/inputtips?parameters'
payload = {
    'key':'f82fc299ab87b74c0281a8ed2b13aba0',
    'keywords':type,
    'location':'location'
}
r = requests.get(url,params=payload)


# In[62]:


r


# In[63]:


r.json()


# In[ ]:




